<%@ page contentType="text/html;charset=UTF-8" %>

<!DOCTYPE html>
<html>
<head>
	<title>数据元素列表管理</title>
     <%@ include file="/common/meta.jsp" %>
	<%@ include file="/common/import.jsp" %>
	
	<script type="text/javascript">
	
		var sortId='${sortId}';
		$(function(){
			$('#metadataList').datagrid({
				title:'信息列表',
				iconCls:'icon-ok',
				url:'${ctx}/info/operate/list!data.action?sortId='+sortId,
				nowrap: false,
				striped: true,
				collapsible:false,	
				pagination:true,			
				fitColumns: true,
				singleSelect:true,
				rownumbers:true,
				remoteSort: false,
				pageList:[10,15,20,30],
				idField:'infoId',
				columns:[[
					{field:'title',title:'标题',width:80},
					{field:'category',title:'栏目英文标识',width:120},
					{field:'infoType',title:'信息类型',width:100},
					{field:'infoLevel',title:'信息级别',width:80},
					{field:'status',title:'状态',width:60,
						formatter:function(value){
							if(value=="0"){
							    return "待审";
							}else if(value=="1"){
							    return "已审核";
							}else if(value=="-1"){
							    return "已驳回";
							}
						}
					},
					{field:'createUser',title:'创建人',width:60},
					{field:'foreignKeyName',title:'操作',width:80,
					    formatter:function(value,rowData){
						    var str ="";
							if(rowData.status=="0"){
								str += " <a href='javascript:void(0);' onclick=\"checkInfo('"+sortId+"','"+rowData.infoId+"','"+rowData.title+"')\">信息审核</a>";
							} 
							return str;
						}
					}		
				]]
			});
		});	
		var widthcount = $(document.body).width()-20; 
		var leftcount = document.documentElement.scrollLeft;
		
		function checkInfo(sortId,infoId,title){
			if(infoId){
				var deptListUrl = '${ctx}/info/operate/init!check.action?sortId='+sortId+"&infoId="+infoId;
				if ($.isFunction(window.parent.addTab)){
				    window.parent.addTab('信息审核['+title+']',deptListUrl,'icon-dept');
				}else{
					$('#orgDeptWin').css({"width":widthcount,"height":"450px","left":leftcount});
					$('#orgDeptFrame').attr("src",deptListUrl);
					$('#orgDeptWin').panel('setTitle',"信息审核["+title+"]");
					$('#orgDeptWin').window('open');
				}
			}
		}
		// 判断修改、删除前是否选中记录
		function getSelected(){
			var selected = $('#metadataList').datagrid('getSelected');
			if (selected){
				return selected;
			}else{
				$.messager.alert('提示', '请选择要操作的数据', 'info');
			}
		}
		// 刷新列表
		function reload(){
			$('#metadataList').datagrid('reload');
		}
		// 关闭窗口
		function closeAdd(){
			$('#orgDeptWin').window('close');
		}
	</script>
</head>

<body>
	
	<table id="metadataList"></table>

	<div id="orgDeptWin" class="easyui-window" title="信息审核" style="padding:5px;float:left;top:10px;" iconCls="icon-search" closed="true" minimizable="false" maximizable="false" maximized="true" collapsible="false">
   	 <iframe frameborder="0" id="orgDeptFrame" height="100%" width="100%" scrolling="No" frameborder="0" ></iframe>
    </div>
    
</body>
</html>